package com.health.controller;

import com.health.annotation.AdminLog;
import com.health.common.Result;
import com.health.entity.PhysicalOrder;
import com.health.entity.pojo.dto.QueryPhysicalOrderDTO;
import com.health.entity.pojo.dto.QueryRegisterOrderDTO;
import com.health.entity.pojo.vo.AppointRegisterDownloadVO;
import com.health.service.IPhysicalOrderService;
import com.health.service.IRegisterOrderService;
import com.health.util.EasyExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>
 * 体检订单 前端控制器
 * </p>
 *
 * @author health
 * @since 2023-04-20
 */
@Api(tags = "体检订单管理")
@RestController
@RequestMapping("/physicalOrder")
public class PhysicalOrderController extends BaseController {
    @Autowired
    IPhysicalOrderService iPhysicalOrderService;

    @PostMapping("/listPagePhysicalOrder")
    @ApiOperation("多条件查询订单订单列表")
    @AdminLog("多条件查询体检订单列表")
    public Result listPagePhysicalOrder(@RequestBody QueryPhysicalOrderDTO physicalOrderDTO){
        return dataResult(iPhysicalOrderService.listPagePhysicalOrder(physicalOrderDTO));
    }


    @PostMapping("/exportPhysicalOrders")
    @ApiOperation("导出体检订单列表")
    @AdminLog("导出体检订单列表")
    public void exportPhysicalOrderExcel(@RequestBody QueryPhysicalOrderDTO physicalOrderDTO, HttpServletResponse response) throws IOException {
        EasyExcelUtil.download(response,  PhysicalOrder.class, iPhysicalOrderService.listPageDownloadPhysicalOrder(physicalOrderDTO));
    }
}
